<include file="public/header"/>
<style>
    .d{
        float: left;
    }
</style>
<div class="am-cf admin-main">
    <!-- sidebar start -->
    <include file="public/sidebar"/>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">
        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单列表</strong></div>
            <span style="color: red">{$desc}</span>
            <!--gcEnd-->
            <if condition="$status eq 1">
            <a id="getValueGc" style="margin-left: 20px;">
            <button type="button" class="am-btn am-btn-secondary am-round am-btn-xs">批量制作完成</button>
            </a>
                <form method="post" action="__URL__/../Search/gcOrderSearch" class="am-form">
                    <div class="am-form-group am-fl">
                        <select name="select" id="select">
                            <option value="user">客户</option>
                        </select>
                    </div>
                    <div class="am-u-md-3 am-cf">
                        <div class="am-fr">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="ifin" id="ifin">
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="submit">搜索</button>
                </span>
                            </div>
                        </div>
                    </div>
                </form>
            </if>
            <!--end-->
            <!--gcReturnEnd-->
            <if condition="$s eq 5">
                <if condition="session('role') eq 4">
            <a id="getValueGcReturn" style="margin-left: 20px;">
                <button type="button" class="am-btn am-btn-success am-round am-btn-xs">批量返工完成</button>
            </a>
                    </if>
            </if>
            <!--end-->

        </div>

        <div class="am-g">
            <div class="am-u-md-6 am-cf">
                <form method="post" action="__URL__/export" class="am-form">
                    <div class="d" >
                    <input type="text" name="start_date" id="start_date" placeholder="开始日期"
                           onclick="laydate()" style="width: 120px;"/>
                    </div>
                    <div class="d" >
                    ~
                        </div>
                    <div class="d" style="margin-right: 20px;">
                    <input type="text" name="end_date" id="end_date" placeholder="结束日期"
                           onclick="laydate()" style="width: 120px;"/>
                        </div>
                    <div class="d">
                    <button type="submit">导出excel</button>
                        </div>
                </form>
            </div>
            <form method="post" action="__URL__/../Search/dateSearch" class="am-form">
                <div class="am-form-group am-margin-left am-fl">
                    <input type="text" name="start_date" placeholder="开始日期"
                           onclick="laydate()"/>
                </div>
                <div class="am-u-md-3 am-cf">
                    <div class="am-fr">
                        <div class="am-input-group am-input-group-sm">
                            <input type="text" name="end_date" placeholder="结束日期"
                                    onclick="laydate()"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="submit">搜索</button>
                </span>
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div class="am-g">
            <div class="am-u-sm-12">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-check"><input type="checkbox" id="all"/></th>
                        <th class="table-author">客户</th>
                        <th class="table-title">派单时间</th>
                        <th class="table-title">编号</th>
                        <th class="table-id">做工</th>
                        <th class="table-id">衣服类型</th>
                        <th class="table-id">性别</th>
                        <th class="table-id">数量</th>
                        <th class="table-type">面料</th>
                        <th class="table-type">领型</th>
                        <th class="table-type">袖型</th>
                        <th class="table-type">门襟</th>
                        <th class="table-type">口袋</th>
                        <th class="table-type">类型</th>
                        <th class="table-type">返工日期</th>
                        <if condition="$s eq 5">
                            <th class="table-type">返工理由</th>
                            <else/>
                            <th class="table-type">备注</th>
                        </if>
                        <th class="table-type">状态</th>
                        <if condition="session('role') neq 4">
                        <th class="table-type">工厂</th>
                        </if>
                        <th class="table-set">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <foreach name="datas" item="data">
                        <tr>
                            <td><input type="checkbox" name="oid[]" class="check" value="{$data.oid}"/></td>
                            <td><a href="__URL__/../User/ltInfo/id/{$data.uid}">{$data.name}</a></td>
                            <td>{$data.gc_updated|date="Y-m-d",###}</td>
                            <td>{$data.orderNum2}</td>
                            <td>{$data.zuo}</td>
                            <td>{$data.xf_type}</td>
                            <td>{$data.sex}</td>
                            <if condition="$data.pro_id eq 1">
                                <td>{$data.num}</td>
                                <td>{$data.color}</td>
                                <td>{$data.collar_type}</td>
                                <td>{$data.sleeve_type}</td>
                                <td>{$data.front_fly}</td>
                                <td>{$data.pocket}</td>
                                <td>{$data.type}</td>
                                <if condition="$data.return_time neq null">
                                <td>{$data.return_time|date="Y-m-d H:i:s",###}</td>
                                    <else/><td></td>
                                </if>
                                <elseif condition="$data.pro_id eq 2"/>
                                <td>{$data.xf_num}</td>
                                <td>{$data.xf_color}</td>
                                <td>{$data.lapel}</td>
                                <td>{$data.jag}</td>
                                <td>{$data.sleeve_fork}</td>
                                <td>{$data.xf_pocket}</td>
                                <td>{$data.fastener}</td>
                                <if condition="$data.return_time neq null">
                                    <td>{$data.return_time|date="Y-m-d H:i:s",###}</td>
                                    <else/><td></td>
                                </if>
                            </if>
                            <td>{$data.descr2}</td>
                            <switch name="data.status">
                                <case value="1">
                                    <td>新订单</td>
                                </case>
                                <case value="2">
                                    <td>工厂完工</td>
                                </case>
                                <case value="3">
                                    <td>待配送</td>
                                </case>
                                <case value="4">
                                    <td>已配送</td>
                                </case>
                                <case value="5">
                                    <td>返工单</td>
                                </case>
                                <default/>
                                <td>返工完工</td>
                            </switch>
                            <if condition="session('role') neq 4">
                                <td>{$data.belong_gc}</td>
                            </if>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <if condition="$data.status eq 1">
                                            <a href="__URL__/orderEnd/id/{$data.oid}">
                                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                    <span class="am-icon-pencil-square-o"></span>
                                                    制作完成
                                            </button>
                                            </a>
                                            <a href="__URL__/../Print/printOrder_gc/id/{$data.oid}">
                                            <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                    打印预览
                                                </button>
                                            </a>
                                        </if>
                                        <if condition="$data.status eq 5">
                                            <if condition="session('role') eq 0">
                                                <a href="__URL__/fgOrderEdit/id/{$data.oid}">
                                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                        <span class="am-icon-pencil-square-o"></span>
                                                        修改</button>
                                                </a>
                                                <elseif condition="session('role') eq 4"/>
                                                <a href="__URL__/fgEnd/id/{$data.oid}">
                                                <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                                        <span class="am-icon-pencil-square-o"></span>
                                                        返工完成
                                                </button>
                                                </a>
                                            </if>
                                        </if>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
                <div class="am-cf">
                    {$page}
                </div>
                <hr/>
                </form>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
        <script>
            $("#all").click(function () {
                if (this.checked) {
                    $(".check").attr("checked", true);
                } else {
                    $(".check").attr("checked", false);
                }
            });
            //批量工厂制作完成AJAX
            $("#getValueGc").click(function () {
                var arr = new Array;
                $("input[name='oid[]']:checked").each(function () {
                    arr.push($(this).val());
                });
                $.post(
                        "http://001.hitailor.com/Batch/batchGet",
//                "http://localhost/thinkphp/index.php/Admin/Batch/batchGet",
                        {"oids":arr},
                        function (returnData) {
                           window.location.href="http://001.hitailor.com/Batch/batchEndGc/ids/"+returnData.content;
//                        window.location.href="http://localhost/thinkphp/index.php/Admin/Batch/batchEndGc/ids/"+returnData.content;
                        }
                );
            });
            //批量工厂返工完成AJAX
            $("#getValueGcReturn").click(function () {
                var arr = new Array;
                $("input[name='oid[]']:checked").each(function () {
                    arr.push($(this).val());
                });
                $.post(
                        "http://001.hitailor.com/Batch/batchGet",
//                        "http://localhost/thinkphp/index.php/Admin/Batch/batchGet",
                        {"oids":arr},
                        function (returnData) {
                           window.location.href="http://001.hitailor.com/Batch/batchReturnEndGc/ids/"+returnData.content;
//                            window.location.href="http://localhost/thinkphp/index.php/Admin/Batch/batchReturnEndGc/ids/"+returnData.content;
                        }
                );
            });
        </script>
<include file="public/footer"/>